package cn.stylefeng.guns.sys.modular.dataAnalyse.controller;

import cn.stylefeng.guns.sys.modular.dataAnalyse.service.DataAnalyseService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/dataAnalyse")
public class DataAnalyseController {

    private String PREFIX = "/modular/dataAnalyse/dataAnalyse";

    @Autowired
    private DataAnalyseService analyseService;

    /**
     * 跳转到主页面
     *
     * @author author
     * @Date 2020-11-19
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/dataAnalyse.html";
    }

    /**
     * 获取问题数据总数
     *
     * @return
     */
    @RequestMapping("/problemDataTotal")
    @ResponseBody
    public int problemDataTotal() {
        return this.analyseService.queryProblemTotal();
    }


    /**
     * 获取部门以及各部门的数据
     *
     * @return
     */
    @RequestMapping("/departmentData")
    @ResponseBody
    public JSONObject departmentData() {
        return this.analyseService.queryDataByDepartmentInfo();
    }
}
